package com.yqb.study.common.pagination;

import java.util.List;

import com.baomidou.mybatisplus.plugins.Page;

/**
 * 分页结果的封装(for Bootstrap Table)
 *
 * @author fengshuonan
 * @Date 2017年1月22日 下午11:06:41
 */
public class PageInfoRspBT<T> {

    // 当前查询结果集
    private List<T> rows;

    // 总数
    private long total;
    
    /* 每页显示条数*/
    private long size;
    
    /* 当前页 */
    private long current;    

    /* 总页数 */
    private long pages;

    // 排序字段
    private String orderByField;

    /**
     * 是否为升序 ASC（ 默认： true ）
     */
    private boolean isAsc = true;   
    
	public PageInfoRspBT(Page<T> page) {
        this.rows = page.getRecords();
        this.total = page.getTotal();
        this.size = page.getSize();
        this.pages = page.getPages();
        this.current = page.getCurrent();
        this.orderByField = page.getOrderByField();
        this.isAsc = page.isAsc();
    }    

    public long getSize() {
		return size;
	}

	public void setSize(long size) {
		this.size = size;
	}

	public long getCurrent() {
		return current;
	}

	public void setCurrent(long current) {
		this.current = current;
	}

	public long getPages() {
		return pages;
	}

	public void setPages(long pages) {
		this.pages = pages;
	}

	public String getOrderByField() {
		return orderByField;
	}

	public void setOrderByField(String orderByField) {
		this.orderByField = orderByField;
	}

	public boolean isAsc() {
		return isAsc;
	}

	public void setAsc(boolean isAsc) {
		this.isAsc = isAsc;
	}

    public List<T> getRows() {
        return rows;
    }

    public void setRows(List<T> rows) {
        this.rows = rows;
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }
}
